package designPatterns;

import java.util.Objects;

public enum TypeEnum {

    /**
     * 支付类型
     */

    ALIPAY(1, "支付宝支付"),
    WECHATPAY(2, "微信支付"),
    APPLEPAY(3, "苹果支付"),
    UNIONPAY(4, "银联支付"),
    OTHER(5, "其他");


    private Integer type;
    private String description;


    TypeEnum(Integer type, String description) {
        this.type = type;
        this.description = description;
    }


    public static TypeEnum getPay(int type) {

        for (TypeEnum typeEnum : TypeEnum.values()) {
            if (Objects.equals(type, typeEnum.getType())) {
                return typeEnum;
            }
        }
        return OTHER;
    }

    public Integer getType() {
        return type;
    }

    public String getDescription() {
        return description;
    }
}
